package com.itheima.reggie.common;

/**
 * ClassName: BaseContext
 * Package: com.itheima.reggie.common
 * Description: 基于ThreadLocal封装工具类,用来保存和获取当前登录用户ID
 *
 * @Author www.youkewang.top
 * @Create 2023-10-24 18:15
 * @Version 1.0
 */
public class BaseContext {
    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();
    // 设置值
    public static void setCurrentId (Long id) {
        threadLocal.set(id);
    }
    // 获取值
    public static Long getCurrentId () {
        return threadLocal.get();
    }
}
